package com.shujia.wyh.day13.studenttest1;

public class ProductThread extends Thread{
    private Student student;
    public int i = 0;

    public ProductThread(Student student) {
        this.student = student;
    }

    @Override
    public void run() {
//        Student student = new Student();
        while (true){
            synchronized (student){
                if(i%2==0){
                    student.name = "吴涛";
                    student.age = 18;
                }else {
                    student.name = "苏康";
                    student.age = 16;
                }
                i++;
            }
        }

    }
}
